<?php
class Admin_Form_Advertisement extends Zend_Form{
	public function init(){
		$this->setAttrib('id', 'frmAdminForm');
		
		//mã 
		$id = $this->createElement('hidden', 'advertisement_id');
		
		//tên đăng nhập
		$advertisement_name = $this->createElement('text', 'advertisement_name')
			->setLabel('Tên quảng cáo')
			->setRequired(true);
		
		$advertisement_file = $this->createElement('file', 'file')->setLabel('Chọn hình ảnh đại diện');
		$advertisement_file->addValidator('Extension',false,'jpg,png,gif');
		$advertisement_file->setDestination(PUBLIC_PATH.'/uploads/images/advertisements/tmp');
		
		$advertisement_link = $this->createElement('text', 'advertisement_link');
		$advertisement_link->setLabel('Đường dẫn bài viết');
		
		
		
		$advertisement_advertisement_category_id = $this->createElement('select', 'advertisement_advertisement_category_id');
		$advertisement_advertisement_category_id->setLabel('Phân loại quảng cáo');
		$mdAdvertisementCategory = new Application_Model_DbTable_AdvertisementCategory();
		$advertisement_advertisement_category_id->addMultiOptions($mdAdvertisementCategory->getPairColumn());
		
		$advertisement_status = $this->createElement('select', 'advertisement_status');
		$advertisement_status->addMultiOptions(
				array(0=>"Ẩn",1=>"Hiển thị")
		);
		
		
		$this->addDisplayGroup(array(
		$advertisement_name,
				$advertisement_file,
				$advertisement_link,
				$advertisement_advertisement_category_id,
				$advertisement_status
		), 'basic-info',array('legend'=>'Thông tin cơ bản','class'=>'display-group'));
		$this->addElements(array(
				$advertisement_name,
				$advertisement_file,
				$advertisement_link,
				$advertisement_advertisement_category_id,
				$advertisement_status
		));
		
	}
}